import com.liyingtao.bean.Admin;
import com.liyingtao.dao.AdminMapper;
import com.liyingtao.dao.NewsMapper;
import com.liyingtao.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class test {

    @Test
    public void test1(){

            SqlSession session = SqlSessionFactoryUtil.getSqlSession();
        try {
           
            AdminMapper adminmapper = session.getMapper(AdminMapper.class);
            Admin admin = new Admin("admin","admin");
            System.out.println(adminmapper.addAdmin(admin));
            session.commit();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (session!=null){
             session.close();
            }
        }
    }
    @Test
    public void test2(){
        SqlSession session = SqlSessionFactoryUtil.getSqlSession();
        try {
            NewsMapper newsmapper=session.getMapper(NewsMapper.class);
            List<String> list=newsmapper.getKeywordName("英");
            for(String str :list){
                System.out.println(str);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
